package com.wanji.gateway.device;

import com.wanji.gateway.constant.DeviceStatus;
import lombok.RequiredArgsConstructor;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class RealTimeMonitor {
    private final SimpMessagingTemplate messagingTemplate;

    public void pushDeviceStatus(String deviceId, DeviceStatus status) {
        messagingTemplate.convertAndSend(
                "/topic/status/" + deviceId,
                status);
    }
}
